package data;

import java.util.Vector;

import data.board.*;
import data.pieces.*;

public class Camp {
	private Color color;
	private Player player;
	private Vector<Piece> pieces;
	private Chessboard chessboard;
	
	public Camp(Color c, Player p, Chessboard cb){
		super();
		
		this.color = c;
		this.player = p;
		this.chessboard = cb;
		this.pieces = createPieces();
	}
	
	private Vector<Piece> createPieces() {
		int y;
		Vector<Piece> pieces = new Vector<Piece>();
		Piece p;
		Square s;
		
		y = (color == Color.WHITE) ? 0 : 7;
		
		s = chessboard.get(0, y);
		p = new Rook(this, s);
		s.setPiece(p);
		pieces.add(p);
		
		s = chessboard.get(7, y);
		p = new Rook(this, s);
		s.setPiece(p);
		pieces.add(p);
		
		s = chessboard.get(1, y);
		p = new Knight(this, s);
		s.setPiece(p);
		pieces.add(p);
		
		s = chessboard.get(6, y);
		p = new Knight(this, s);
		s.setPiece(p);
		pieces.add(p);
		
		s = chessboard.get(2, y);
		p = new Bishop(this, s);
		s.setPiece(p);
		pieces.add(p);
		
		s = chessboard.get(5, y);
		p = new Bishop(this, s);
		s.setPiece(p);
		pieces.add(p);
		
		s = chessboard.get(3, y);
		p = new King(this, s);
		s.setPiece(p);
		pieces.add(p);
		
		s = chessboard.get(4, y);
		p = new Queen(this, s);
		s.setPiece(p);
		pieces.add(p);
		
		y = (color == Color.WHITE) ? 1 : 6;
		for(int x = 0; x < 8; x++){
			s = chessboard.get(x, y);
			p = new Pawn(this, s);
			s.setPiece(p);
			pieces.add(p);
		}
		
		return pieces;
	}

	public Color getColor() {
		return color;
	}
	public Player getPlayer() {
		return player;
	}
}
	
